{% extends "layout.html" %}
{% block title %}新建用户{% endblock %}

{% load static %}
{% block css %}
    <link rel="stylesheet" href="{% static 'plugins/bootstrap-datepicker-1.9.0/css/bootstrap-datepicker.css' %}">
{% endblock %}




{% block content %}
      <div class="container">
    <div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">新建用户</h3>
  </div>
  <div class="panel-body">
  <form method="post" action="/user/model/form/add/" novalidate><!--关掉浏览器做的校验-->
      {% csrf_token %}
  {% for field in form %}
      <div class="form-group">
    <label>{{ field.label }}</label>
          {{ field }}
          <span style="color: red">{{ field.errors.0 }}</span>  <!--error中有很多错误[错误1，错误2，错误3]封装为列表-->
  <!--  <input type="text" class="form-control" name="user" placeholder="请输入用户姓名" style="margin-bottom: 10px">-->
  </div>
  {% endfor %}
    <button type="submit" class="btn btn-primary">提 交</button>
</form>
  </div>
</div>
</div>
{% endblock %}




{% block js %}
    <script src="{% static 'plugins/bootstrap-datepicker-1.9.0/js/bootstrap-datepicker.js' %}"></script>
    <script src="{% static 'plugins/bootstrap-datepicker-1.9.0/locales/bootstrap-datepicker.zh-CN.min.js' %}"></script>
    <script>
    $(function (){
        {#Django中日期会自动加一个id=“id_字段名”#}
        $('#id_create_time').datepicker({
            format: 'yyyy-mm-dd',
            startDate :'0',
            language: "zh-CN",
            autoclose: true
        });
    })
    </script>
{% endblock %}
{#<form method="post">#}
{#    {% csrf_token %}#}
{#    {% for field in form %}#}
{#        {{ field.label }}: {{ field }}#}
{#    {% endfor %}#}
{#     {{ form.name.label }}: {{ form.name }}#}
{#     {{ form.password.label }}: {{ form.password }}#}
{#     {{ form.age.label }}: {{ form.age }}#}
{#</form>#}
{#</body>#}
{#</html>#}